package com.cj.mobile.iabp.mvp.model.entity;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

/**
 * 还款交易试算
 */
public class RepaymentPlanTrialResponse implements Parcelable {

    public RepaymentPlanTrialResponse(double cuAmt, double cuTotalAmt, double cuInt,int totalCount,int rowsCount,String loanTime,double totalPrincipal,String repayMode) {
        this.cuAmt = cuAmt;
        this.cuTotalAmt = cuTotalAmt;
        this.cuInt = cuInt;
        this.totalCount = totalCount;
        this.rowsCount = rowsCount;
        this.loanTime = loanTime;
        this.totalPrincipal = totalPrincipal;
        this.repayMode = repayMode;
    }

    /**
     * repayMode : null
     * penalty : null
     * totalCount : null
     * cuAmt : null
     * totalPrincipal : null
     * cuTotalAmt : null
     * rows : [{"currentPeriod":"","currentPrincipalInterest":"","currentPrincipal":"","currentInterest":"","endCurrentPrincipalBalance":"","repayDate":""}]
     * totalAmt : null
     * cuInt : null
     * rowsCount : null
     * totalFee : null
     * totalIntAmt : null
     */

    // 还款方式：5-等额本金，3-等额本息，2-按固定周期付息、到期还本，0-期末本息一次付清 测试固定用 3
    private String repayMode;
    // 违约金
    private double penalty;
    // 总条数
    private int totalCount;
    // 应还当期本金
    private double cuAmt;
    // 本金总额
    private double totalPrincipal;
    // 本次应还总额
    private double cuTotalAmt;
    // 还款总额
    private double totalAmt;
    // 应还当期利息
    private double cuInt;
    // 循环体条数
    private int rowsCount;
    // 费用总额
    private double totalFee;
    // 利息总额
    private double totalIntAmt;
    // 借款日期
    private String loanTime;
    private List<RowsBean> rows;

    public String getLoanTime() {
        return loanTime;
    }

    public void setLoanTime(String loanTime) {
        this.loanTime = loanTime;
    }

    public String getRepayMode() {
        return repayMode;
    }

    public void setRepayMode(String repayMode) {
        this.repayMode = repayMode;
    }

    public double getPenalty() {
        return penalty;
    }

    public void setPenalty(double penalty) {
        this.penalty = penalty;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public double getCuAmt() {
        return cuAmt;
    }

    public void setCuAmt(double cuAmt) {
        this.cuAmt = cuAmt;
    }

    public double getTotalPrincipal() {
        return totalPrincipal;
    }

    public void setTotalPrincipal(double totalPrincipal) {
        this.totalPrincipal = totalPrincipal;
    }

    public double getCuTotalAmt() {
        return cuTotalAmt;
    }

    public void setCuTotalAmt(double cuTotalAmt) {
        this.cuTotalAmt = cuTotalAmt;
    }

    public double getTotalAmt() {
        return totalAmt;
    }

    public void setTotalAmt(double totalAmt) {
        this.totalAmt = totalAmt;
    }

    public double getCuInt() {
        return cuInt;
    }

    public void setCuInt(double cuInt) {
        this.cuInt = cuInt;
    }

    public int getRowsCount() {
        return rowsCount;
    }

    public void setRowsCount(int rowsCount) {
        this.rowsCount = rowsCount;
    }

    public double getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(double totalFee) {
        this.totalFee = totalFee;
    }

    public double getTotalIntAmt() {
        return totalIntAmt;
    }

    public void setTotalIntAmt(double totalIntAmt) {
        this.totalIntAmt = totalIntAmt;
    }

    public List<RowsBean> getRows() {
        return rows;
    }

    public void setRows(List<RowsBean> rows) {
        this.rows = rows;
    }

    public static class RowsBean implements Parcelable {
        public RowsBean() {
        }

        public RowsBean(int currentPeriod, double currentPrincipalInterest, double currentPrincipal, double currentInterest, double endCurrentPrincipalBalance, String repayDate) {
            this.currentPeriod = currentPeriod;
            this.currentPrincipalInterest = currentPrincipalInterest;
            this.currentPrincipal = currentPrincipal;
            this.currentInterest = currentInterest;
            this.endCurrentPrincipalBalance = endCurrentPrincipalBalance;
            this.repayDate = repayDate;
        }

        /**
         * currentPeriod :
         * currentPrincipalInterest :
         * currentPrincipal :
         * currentInterest :
         * endCurrentPrincipalBalance :
         * repayDate :
         */

        // 期数
        private int currentPeriod;
        // 应还总额
        private double currentPrincipalInterest;
        // 应还本金
        private double currentPrincipal;
        // 应还利息
        private double currentInterest;
        // 剩余本金
        private double endCurrentPrincipalBalance;
        // 还款日期
        private String repayDate;

        public int getCurrentPeriod() {
            return currentPeriod;
        }

        public void setCurrentPeriod(int currentPeriod) {
            this.currentPeriod = currentPeriod;
        }

        public double getCurrentPrincipalInterest() {
            return currentPrincipalInterest;
        }

        public void setCurrentPrincipalInterest(double currentPrincipalInterest) {
            this.currentPrincipalInterest = currentPrincipalInterest;
        }

        public double getCurrentPrincipal() {
            return currentPrincipal;
        }

        public void setCurrentPrincipal(double currentPrincipal) {
            this.currentPrincipal = currentPrincipal;
        }

        public double getCurrentInterest() {
            return currentInterest;
        }

        public void setCurrentInterest(double currentInterest) {
            this.currentInterest = currentInterest;
        }

        public double getEndCurrentPrincipalBalance() {
            return endCurrentPrincipalBalance;
        }

        public void setEndCurrentPrincipalBalance(double endCurrentPrincipalBalance) {
            this.endCurrentPrincipalBalance = endCurrentPrincipalBalance;
        }

        public String getRepayDate() {
            return repayDate;
        }

        public void setRepayDate(String repayDate) {
            this.repayDate = repayDate;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(this.currentPeriod);
            dest.writeDouble(this.currentPrincipalInterest);
            dest.writeDouble(this.currentPrincipal);
            dest.writeDouble(this.currentInterest);
            dest.writeDouble(this.endCurrentPrincipalBalance);
            dest.writeString(this.repayDate);
        }

        protected RowsBean(Parcel in) {
            this.currentPeriod = in.readInt();
            this.currentPrincipalInterest = in.readDouble();
            this.currentPrincipal = in.readDouble();
            this.currentInterest = in.readDouble();
            this.endCurrentPrincipalBalance = in.readDouble();
            this.repayDate = in.readString();
        }

        public static final Creator<RowsBean> CREATOR = new Creator<RowsBean>() {
            @Override
            public RowsBean createFromParcel(Parcel source) {
                return new RowsBean(source);
            }

            @Override
            public RowsBean[] newArray(int size) {
                return new RowsBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.repayMode);
        dest.writeDouble(this.penalty);
        dest.writeInt(this.totalCount);
        dest.writeDouble(this.cuAmt);
        dest.writeDouble(this.totalPrincipal);
        dest.writeDouble(this.cuTotalAmt);
        dest.writeDouble(this.totalAmt);
        dest.writeDouble(this.cuInt);
        dest.writeInt(this.rowsCount);
        dest.writeDouble(this.totalFee);
        dest.writeDouble(this.totalIntAmt);
        dest.writeString(this.loanTime);
        dest.writeList(this.rows);
    }

    protected RepaymentPlanTrialResponse(Parcel in) {
        this.repayMode = in.readString();
        this.penalty = in.readDouble();
        this.totalCount = in.readInt();
        this.cuAmt = in.readDouble();
        this.totalPrincipal = in.readDouble();
        this.cuTotalAmt = in.readDouble();
        this.totalAmt = in.readDouble();
        this.cuInt = in.readDouble();
        this.rowsCount = in.readInt();
        this.totalFee = in.readDouble();
        this.totalIntAmt = in.readDouble();
        this.loanTime = in.readString();
        this.rows = new ArrayList<RowsBean>();
        in.readList(this.rows, RowsBean.class.getClassLoader());
    }

    public static final Parcelable.Creator<RepaymentPlanTrialResponse> CREATOR = new Parcelable.Creator<RepaymentPlanTrialResponse>() {
        @Override
        public RepaymentPlanTrialResponse createFromParcel(Parcel source) {
            return new RepaymentPlanTrialResponse(source);
        }

        @Override
        public RepaymentPlanTrialResponse[] newArray(int size) {
            return new RepaymentPlanTrialResponse[size];
        }
    };
}
